<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>添加采购申请</title>
    <base href="/">

    <link rel="shortcut icon" href="assets/media/image/favicon.png"/>
    <link rel="stylesheet" href="vendors/bundle.css" type="text/css">
    <link rel="stylesheet" href="vendors/datepicker/daterangepicker.css">
    <link rel="stylesheet" href="vendors/vmap/jqvmap.min.css">
    <link rel="stylesheet" href="assets/css/app.css" type="text/css">
    <!--弹窗CSS-->
    <link rel="stylesheet" href="assets/css/modal.css" type="text/css">
</head>
<body class="container">

<div class="preloader">
    <div class="preloader-icon"></div>
</div>

<!--引入公共头部页面-->
<div th:replace="~{commons/header :: header}"></div>

<div id="main">
    <!--引入公共导航栏页面-->
    <div th:replace="~{commons/navigation :: navigation}"></div>

    <div class="main-content">
        <div class="row">
            <div class="col-md-12 card" style="margin-left: 15px">
                <form onsubmit="return false" action="/user/add_purchase" id="add-request" method="post"
                      style="margin-left:20px;margin-top: 50px;margin-bottom: 50px">
                    <div>
                        <div class="form-group row" style="margin-left: 10px">采购信息：</div>
                        <div class="form-group row justify-content-start" style="margin-left: 30px">
                            <div class="row col-md-6">
                                <label class="col-form-label text-right">申请日期：</label>
                                <div>
                                    <label th:text="${#dates.format(purchapplyDetail.createDate,'yyyy-MM-dd')}" type="date" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-sm-6">
                                <label class="col-form-label text-right">报价截至时间：</label>
                                <div>
                                    <label th:text="${#dates.format(purchapplyDetail.deadline,'yyyy-MM-dd')}" type="date" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">单据编号：</label>
                                <div>
                                    <label th:text="${purchapply.documentNumber}" type="date" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">申请单位：</label>
                                <div>
                                    <label th:text="${company.companyName}" type="date" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <span class="col-form-label text-right">申&nbsp;&nbsp;请&nbsp;&nbsp;人：</span>
                                <div>
                                    <label th:text="${applicantUser.name}" type="date" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">签&nbsp;&nbsp;发&nbsp;&nbsp;人：</label>
                                <div>
                                    <label th:text="${signerUser.name}" type="date" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">交货时间：</label>
                                <div>
                                    <label th:text="${#dates.format(purchapplyDetail.jhTime,'yyyy-MM-dd')}" type="date" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">至</label>
                                <div>
                                    <label th:text="${#dates.format(purchapplyDetail.jhDeadline,'yyyy-MM-dd')}" type="date" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">煤&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;种：</label>
                                <div>
                                    <label th:text="${purchapply.coalType}"  class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">采购数量：</label>
                                <div>
                                    <label th:text="${purchapply.procureCount}"  class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                                <label class="col-form-label text-right">（万吨）</label>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">运输方式：</label>
                                <div>
                                    <label th:text="${purchapplyDetail.yunShuMode}"  class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">交货地点：</label>
                                <div>
                                    <label th:text="${purchapplyDetail.jiaoHuoMode}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">结算方式：</label>
                                <div>
                                    <label th:text="${purchapplyDetail.jieSuanMode}"  class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">验收方式：</label>
                                <div>
                                    <label th:text="${purchapplyDetail.yanShouMode}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">最高限价：</label>
                                <div>
                                    <label th:text="${purchapplyDetail.maxLimitPrice}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">最低限价：</label>
                                <div>
                                    <label th:text="${purchapplyDetail.minLimitPrice}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">付款方式：</label>
                                <div>
                                    <label th:text="${purchapplyDetail.payMode}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group row justify-content-start" style="margin-left: 30px">
                            <label class="col-form-label" style="color: #505050">保证金要求：</label>
                            <textarea name="detailRemark" style="border:none; height: 100px" class="col-md-8 form-control" rows="3">参加采购需求单报价时，要求通过缴纳500,000元报价保证金;</textarea>
                        </div>
                    </div>
                    <br>
                    <br>
                    <div>
                        <div class="form-group row" style="margin-left: 10px">煤质信息：</div>

                        <label class="col-form-label" style="margin: 0;margin-left: 30px;padding: 0">收到基准：</label>
                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">收到基低位发热量：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.qnetAr,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">收到基全硫St,ar(%)≤：</label>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.stAr,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <span class="col-form-label text-right">全水分Mt(%)≤：</span>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.moisture,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <span class="col-form-label text-right">收到基灰分Aar(%)≤：&nbsp;&nbsp;</span>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.aar,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <span class="col-form-label text-right">收到基挥发分Var(%)：&nbsp;</span>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.varS,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                                <div class="d-inline-block" style="margin-top: 6px">至</div>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.varD,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4"></div>
                        </div>

                        <label class="col-form-label" style="margin: 0;margin-left: 30px;padding: 0">空气干燥基基准：</label>
                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">空干基水分Mad(%)≤：</label>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.mad,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">空干基全硫St,ad(%)≤：</label>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.stAd,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <span class="col-form-label text-right">空干基挥发分Vad(%)：</span>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.vadS,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                                <div class="d-inline-block" style="margin-top: 6px">至</div>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.varD,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>

                        <label class="col-form-label" style="margin: 0;margin-left: 30px;padding: 0">干燥基基准：</label>
                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">干基高位发热量：</label>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.qgrD,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">干基全硫St,d(%)≤：</label>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.stD,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <span class="col-form-label text-right">干燥无灰基挥发分：&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.davS,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                                <div class="d-inline-block" style="margin-top: 6px">至</div>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.davD,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group row justify-content-center">
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">粒&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;度(mm)≤：</label>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.mm,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <label class="col-form-label text-right">灰&nbsp;&nbsp;熔&nbsp;&nbsp;点ST(℃)≥：&nbsp;</label>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.st,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                            <div class="row col-md-4">
                                <span class="col-form-label text-right">哈式可磨系数(HGI)≥：</span>
                                <div>
                                    <label th:text="${#numbers.formatInteger(coalQuality.hgi,0)}" class="form-control form-control-sm" style="border-radius: .30em;margin-top: 3px;border: none"></label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group row justify-content-start" style="margin-left: 30px">
                            <label class="col-form-label" style="color: #505050">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</label>
                            <textarea name="coalRemark" style="height: 100px" class="col-md-8 form-control" rows="3">收到基低位发热量值，要求在5300-5500区间内</textarea>
                        </div>
                    </div>
                    <br>

                    <div class="form-group row justify-content-start" style="margin-left: 30px">
                        <div class="col-sm-6 text-right">
                        </div>
                        <div class="col-sm-4 text-right">
                            <a type="button" th:href="${#request.getHeader('Referer')}" class="btn btn-gradient-dark" style="border-radius: .30em;">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <!--引入公共的footer-->
        <div th:replace="~{commons/footer :: footer}"></div>
    </div>
</div>

<!--引入公共的JavaScript脚本-->
<div th:include="~{commons/scripts :: scripts}"></div>
<script src="assets/js/app.js"></script>
<script src="assets/js/modal.js"></script>
<script>
    $(() => {
        $('#add-request').submit(function () {
            let flag = 0;
            $('#add-request input,#add-request select,#add-request textarea').each(function () {
                if (this.value === "") {
                    flag = 1;
                    var mModal1 = new mModal({
                        title: "提示", // 标题，默认：提示
                        width: "25%", // 弹出框宽度，默认 25%
                        top: "25vh", // 距离可视区域顶部距离 CSS中 margin-top 值
                        content: "你还有未填写的信息", // 正文，默认：正文内容
                        cancelText: "取 消", // 取消按钮文本
                        confirmText: "确 定", // 确定按钮文本
                        showCancelButton: false, // 是否显示取消按钮
                        showConfirmButton: true, // 是否显示确定按钮
                        showClose: true, // 是否显示关闭按钮
                        modal: true, // 是否需要遮罩层
                        customClass: "", // 自定义类名confirm
                        confirm: function () {
                            mModal1.close();
                        },
                    });
                    mModal1.renderDom();
                    return false;
                }
            });
            if (flag === 0) {
                let data = $(this).serializeArray();
                let url = "/user/add_purchase";
                $.post(url, data, function (data) {
                    let content = "发起采购失败";
                    let method = Function();
                    if (data.code >= 0) {
                        method = function () {
                            window.location.href = /*[[${#request.getHeader('Referer')}]]*/"/";
                        }
                        content = "发起成功";
                    }
                    var mModal1 = new mModal({
                        title: "提示", // 标题，默认：提示
                        width: "25%", // 弹出框宽度，默认 25%
                        top: "25vh", // 距离可视区域顶部距离 CSS中 margin-top 值
                        content: content, // 正文，默认：正文内容
                        cancelText: "取 消", // 取消按钮文本
                        confirmText: "确 定", // 确定按钮文本
                        showCancelButton: false, // 是否显示取消按钮
                        showConfirmButton: true, // 是否显示确定按钮
                        showClose: true, // 是否显示关闭按钮
                        modal: true, // 是否需要遮罩层
                        customClass: "", // 自定义类名confirm
                        confirm: function () {
                            mModal1.close();
                            method();
                        },
                    });
                    mModal1.renderDom();
                }, "json")
            }
            return false;
        })
    })
</script>
</body>

</html>